package com.aceleeyy.sevenstar;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SpringBootApplication
public class SevenStarApplication extends WebMvcConfigurerAdapter {

    @Value("${file.save.path}")
    private String uploadPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        super.addResourceHandlers(registry);
        registry.addResourceHandler("/files/**").addResourceLocations(
                "file:"+uploadPath).setCachePeriod(24 * 60 * 60 * 1000);
    }

    public static void main(String[] args) {
        SpringApplication.run(SevenStarApplication.class, args);
    }

}
